Global.areaQuery.layer = new SuperMap.Layer.Vector("区域查询");

/**
 * @note 地图区域查询
 * @author 吴义迪
 * @create_time 2017-07-16
 */
function mapAreaQuery(type){
	bxfbExit();
	var layers = Global.common.map.getLayersByName(Global.areaQuery.layer.name);
	if(layers.length <= 0){
		Global.areaQuery.layer.style = Global.areaQuery.layerStyle;
	    Global.common.map.addLayer(Global.areaQuery.layer);
	    layerIndexControl(Global.areaQuery.layer);
	}
	Global.areaQuery.drawFeature.deactivate();
	Global.areaQuery.drawFeature1.deactivate();
	Global.areaQuery.drawFeature2.deactivate();
	Global.areaQuery.drawFeature3.deactivate();
	if(type == "yx"){
		Global.areaQuery.drawFeature1.activate();
	}else if(type == "jx"){
		Global.areaQuery.drawFeature2.activate();
	}else if(type == "dbx"){
		Global.areaQuery.drawFeature.activate();
	}else if(type == "ry"){
		Global.areaQuery.drawFeature3.activate();
		stopDragMap();
	}
}

/**
 * @note 地图区域查询
 * @author 吴义迪
 * @create_time 2017-07-17
 */
function removeAreaQueryLayer(){
	Global.areaQuery.continueDrawFlag = false;
	var layers = Global.common.map.getLayersByName(Global.areaQuery.layer.name);
	if(layers.length > 0){
		removeSelectFeatureLayersByName(Global.areaQuery.layer.name);
		Global.areaQuery.layer.removeAllFeatures();
		Global.common.map.removeLayer(Global.areaQuery.layer);
		refreshSelectCluster();
	}
	closeLayer("query_30");
	closeLayer("query_31");
	closeLayer("query_32");
	closeLayer("query_33");
	closeLayer("query_34");
	closeLayer("query_35");
	closeLayer("query_36");
	closeLayer("query_37");
	closeLayer("query_38");
	closeLayer("query_39");
	closeLayer("query_40");
	closeLayer("query_41");
	closeLayer("query_42");
	closeLayer("query_43");
	closeLayer("query_44");
	closeLayer("query_45");
	closeLayer("query_46");
	closeLayer("query_47");
	closeLayer("query_48");
	closeLayer("query_49");
	closeLayer("query_50");
	Global.areaQuery.area = null;
	Global.areaQuery.features.town = null;
	Global.areaQuery.features.display = null;
	Global.areaQuery.features.village = null;
	Global.areaQuery.features.cnty = null;
	Global.areaQuery.features.people.town = null;
	Global.areaQuery.features.people.village = null;
	Global.areaQuery.features.school1 = null;
	Global.areaQuery.features.school2 = null;
	Global.areaQuery.features.school3 = null;
	Global.areaQuery.features.school4 = null;
	Global.areaQuery.features.school5 = null;
	Global.areaQuery.features.powerStation = null;
	Global.areaQuery.features.railway = null;
	Global.areaQuery.features.hospital1 = null;
	Global.areaQuery.features.hospital2 = null;
	Global.areaQuery.features.hospital3 = null;
	Global.areaQuery.features.gasStation = null;
	Global.areaQuery.features.restArea = null;
	Global.areaQuery.features.fireStation = null;
	Global.areaQuery.features.hidden1 = null;
	Global.areaQuery.features.hidden2 = null;
	Global.areaQuery.features.alarms1 = null;
	Global.areaQuery.features.alarms2 = null;
	Global.areaQuery.features.alarms3 = null;
	Global.areaQuery.features.alarms4 = null;
	contactPeopleArray = null;
	Global.areaQuery.geometry = [];
}

/**
 * @note 区域查询-绘完触发事件
 * @author 吴义迪
 * @create_time 2017-07-16
 */
function areaQueryDrawCompleted(drawGeometryArgs){
	if(confirm("是否继续绘制？")){
		Global.areaQuery.continueDrawFlag = true;
	}else{
		Global.areaQuery.drawFeature.deactivate();
		Global.areaQuery.continueDrawFlag = false;
	}
	
	//面积量算
	var measureParam = new SuperMap.REST.MeasureParameters(drawGeometryArgs.feature.geometry);
	var myMeasuerService = new SuperMap.REST.MeasureService(Global.common.iserverPath + "/iserver/services/map-world/rest/maps/World");
	myMeasuerService.events.on({ "processCompleted": measureCompleted });
	myMeasuerService.measureMode = SuperMap.REST.MeasureMode.AREA;
    myMeasuerService.processAsync(measureParam);
	
	//获得图层几何对象
    Global.areaQuery.geometry.push(drawGeometryArgs.feature.geometry);
    /* 获取普查信息 */
    var url = Global.common.iserverPath + Global.iserver.rest.data1;
    var getFeaturesByGeometryParameters;
    var getFeaturesByGeometryService;
    getFeaturesByGeometryParameters = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:乡镇级"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService.processAsync(getFeaturesByGeometryParameters);
    
    var getFeaturesByGeometryParameters1;
    var getFeaturesByGeometryService1;
    getFeaturesByGeometryParameters1 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:显示屏"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService1 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted1,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService1.processAsync(getFeaturesByGeometryParameters1);
    
    var getFeaturesByGeometryParameters2;
    var getFeaturesByGeometryService2;
    getFeaturesByGeometryParameters2 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:村级"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService2 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted2,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService2.processAsync(getFeaturesByGeometryParameters2);
    
    var getFeaturesByGeometryParameters3;
    var getFeaturesByGeometryService3;
    getFeaturesByGeometryParameters3 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:qxj"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService3 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted3,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService3.processAsync(getFeaturesByGeometryParameters3);
    
    var getFeaturesByGeometryParameters4;
    var getFeaturesByGeometryService4;
    getFeaturesByGeometryParameters4 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:学校"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService4 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted4,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService4.processAsync(getFeaturesByGeometryParameters4);
    
    var getFeaturesByGeometryParameters5;
    var getFeaturesByGeometryService5;
    getFeaturesByGeometryParameters5 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:医院"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService5 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted5,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService5.processAsync(getFeaturesByGeometryParameters5);
    
    var getFeaturesByGeometryParameters6;
    var getFeaturesByGeometryService6;
    getFeaturesByGeometryParameters6 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:发电站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService6 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted6,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService6.processAsync(getFeaturesByGeometryParameters6);
    
    var getFeaturesByGeometryParameters7;
    var getFeaturesByGeometryService7;
    getFeaturesByGeometryParameters7 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:火车站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService7 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted7,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService7.processAsync(getFeaturesByGeometryParameters7);
    
    var getFeaturesByGeometryParameters8;
    var getFeaturesByGeometryService8;
    getFeaturesByGeometryParameters8 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:加油站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService8 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted8,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService8.processAsync(getFeaturesByGeometryParameters8);
    
    var getFeaturesByGeometryParameters9;
    var getFeaturesByGeometryService9;
    getFeaturesByGeometryParameters9 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:服务区"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService9 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted9,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService9.processAsync(getFeaturesByGeometryParameters9);
    
    var getFeaturesByGeometryParameters10;
    var getFeaturesByGeometryService10;
    getFeaturesByGeometryParameters10 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:消防局"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService10 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted10,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService10.processAsync(getFeaturesByGeometryParameters10);
    
    var getFeaturesByGeometryParameters11;
    var getFeaturesByGeometryService11;
    getFeaturesByGeometryParameters11 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_msc"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService11 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted11,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService11.processAsync(getFeaturesByGeometryParameters11);
    
    var getFeaturesByGeometryParameters12;
    var getFeaturesByGeometryService12;
    getFeaturesByGeometryParameters12 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_tfc"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService12 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted12,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService12.processAsync(getFeaturesByGeometryParameters12);
    
    var getFeaturesByGeometryParameters13;
    var getFeaturesByGeometryService13;
    getFeaturesByGeometryParameters13 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_disa1"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService13 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted13,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService13.processAsync(getFeaturesByGeometryParameters13);
}

/**
 * @note 区域查询-绘完触发事件
 * @author 吴义迪
 * @create_time 2017-07-16
 */
function areaQueryDrawCompleted1(drawGeometryArgs){
	if(confirm("是否继续绘制？")){
		Global.areaQuery.continueDrawFlag = true;
	}else{
		Global.areaQuery.drawFeature1.deactivate();
		Global.areaQuery.continueDrawFlag = false;
	}
	
	//面积量算
	var measureParam = new SuperMap.REST.MeasureParameters(drawGeometryArgs.feature.geometry);
	var myMeasuerService = new SuperMap.REST.MeasureService(Global.common.iserverPath + "/iserver/services/map-world/rest/maps/World");
	myMeasuerService.events.on({ "processCompleted": measureCompleted });
	myMeasuerService.measureMode = SuperMap.REST.MeasureMode.AREA;
    myMeasuerService.processAsync(measureParam);
	
	//获得图层几何对象
	Global.areaQuery.geometry.push(drawGeometryArgs.feature.geometry);
    /* 获取普查信息 */
    var url = Global.common.iserverPath + Global.iserver.rest.data1;
    var getFeaturesByGeometryParameters;
    var getFeaturesByGeometryService;
    getFeaturesByGeometryParameters = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:乡镇级"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService.processAsync(getFeaturesByGeometryParameters);
    
    var getFeaturesByGeometryParameters1;
    var getFeaturesByGeometryService1;
    getFeaturesByGeometryParameters1 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:显示屏"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService1 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted1,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService1.processAsync(getFeaturesByGeometryParameters1);
    
    var getFeaturesByGeometryParameters2;
    var getFeaturesByGeometryService2;
    getFeaturesByGeometryParameters2 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:村级"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService2 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted2,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService2.processAsync(getFeaturesByGeometryParameters2);
    
    var getFeaturesByGeometryParameters3;
    var getFeaturesByGeometryService3;
    getFeaturesByGeometryParameters3 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:qxj"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService3 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted3,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService3.processAsync(getFeaturesByGeometryParameters3);
    
    var getFeaturesByGeometryParameters4;
    var getFeaturesByGeometryService4;
    getFeaturesByGeometryParameters4 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:学校"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService4 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted4,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService4.processAsync(getFeaturesByGeometryParameters4);
    
    var getFeaturesByGeometryParameters5;
    var getFeaturesByGeometryService5;
    getFeaturesByGeometryParameters5 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:医院"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService5 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted5,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService5.processAsync(getFeaturesByGeometryParameters5);
    
    var getFeaturesByGeometryParameters6;
    var getFeaturesByGeometryService6;
    getFeaturesByGeometryParameters6 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:发电站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService6 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted6,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService6.processAsync(getFeaturesByGeometryParameters6);
    
    var getFeaturesByGeometryParameters7;
    var getFeaturesByGeometryService7;
    getFeaturesByGeometryParameters7 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:火车站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService7 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted7,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService7.processAsync(getFeaturesByGeometryParameters7);
    
    var getFeaturesByGeometryParameters8;
    var getFeaturesByGeometryService8;
    getFeaturesByGeometryParameters8 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:加油站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService8 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted8,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService8.processAsync(getFeaturesByGeometryParameters8);
    
    var getFeaturesByGeometryParameters9;
    var getFeaturesByGeometryService9;
    getFeaturesByGeometryParameters9 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:服务区"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService9 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted9,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService9.processAsync(getFeaturesByGeometryParameters9);
    
    var getFeaturesByGeometryParameters10;
    var getFeaturesByGeometryService10;
    getFeaturesByGeometryParameters10 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:消防局"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService10 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted10,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService10.processAsync(getFeaturesByGeometryParameters10);
    
    var getFeaturesByGeometryParameters11;
    var getFeaturesByGeometryService11;
    getFeaturesByGeometryParameters11 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_msc"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService11 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted11,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService11.processAsync(getFeaturesByGeometryParameters11);
    
    var getFeaturesByGeometryParameters12;
    var getFeaturesByGeometryService12;
    getFeaturesByGeometryParameters12 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_tfc"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService12 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted12,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService12.processAsync(getFeaturesByGeometryParameters12);
    
    var getFeaturesByGeometryParameters13;
    var getFeaturesByGeometryService13;
    getFeaturesByGeometryParameters13 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_disa1"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService13 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted13,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService13.processAsync(getFeaturesByGeometryParameters13);
}

/**
 * @note 区域查询-绘完触发事件
 * @author 吴义迪
 * @create_time 2017-07-16
 */
function areaQueryDrawCompleted2(drawGeometryArgs){
	if(confirm("是否继续绘制？")){
		Global.areaQuery.continueDrawFlag = true;
	}else{
		Global.areaQuery.drawFeature2.deactivate();
		Global.areaQuery.continueDrawFlag = false;
	}
	
	//面积量算
	var x = drawGeometryArgs.feature.geometry.x;
	var y = drawGeometryArgs.feature.geometry.y;
	var w = drawGeometryArgs.feature.geometry.width;
	var h = drawGeometryArgs.feature.geometry.height;
	var area = parseFloat((new SuperMap.Geometry.Rectangle(x, y, w, h).getArea()*10000).toFixed(1));
	if(Global.areaQuery.area == null){
		Global.areaQuery.area = area;
	}else{
		Global.areaQuery.area += area;
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_yxmj").html(Global.areaQuery.area.toFixed(1));
	}
	
	//获得图层几何对象
    Global.areaQuery.geometry.push(drawGeometryArgs.feature.geometry.bounds);
    /* 获取普查信息 */
    var url = Global.common.iserverPath + Global.iserver.rest.data1;
    var getFeaturesByBoundsParameters;
    var getFeaturesByGeometryService;
    getFeaturesByBoundsParameters = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:乡镇级"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService.processAsync(getFeaturesByBoundsParameters);
    
    var getFeaturesByBoundsParameters1;
    var getFeaturesByGeometryService1;
    getFeaturesByBoundsParameters1 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:显示屏"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService1 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted1,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService1.processAsync(getFeaturesByBoundsParameters1);
    
    var getFeaturesByBoundsParameters2;
    var getFeaturesByGeometryService2;
    getFeaturesByBoundsParameters2 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:村级"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService2 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted2,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService2.processAsync(getFeaturesByBoundsParameters2);
    
    var getFeaturesByBoundsParameters3;
    var getFeaturesByGeometryService3;
    getFeaturesByBoundsParameters3 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:qxj"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService3 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted3,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService3.processAsync(getFeaturesByBoundsParameters3);
    
    var getFeaturesByBoundsParameters4;
    var getFeaturesByGeometryService4;
    getFeaturesByBoundsParameters4 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:学校"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService4 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted4,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService4.processAsync(getFeaturesByBoundsParameters4);
    
    var getFeaturesByBoundsParameters5;
    var getFeaturesByGeometryService5;
    getFeaturesByBoundsParameters5 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:医院"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService5 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted5,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService5.processAsync(getFeaturesByBoundsParameters5);
    
    var getFeaturesByBoundsParameters6;
    var getFeaturesByGeometryService6;
    getFeaturesByBoundsParameters6 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:发电站"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService6 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted6,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService6.processAsync(getFeaturesByBoundsParameters6);
    
    var getFeaturesByBoundsParameters7;
    var getFeaturesByGeometryService7;
    getFeaturesByBoundsParameters7 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:火车站"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService7 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted7,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService7.processAsync(getFeaturesByBoundsParameters7);
    
    var getFeaturesByBoundsParameters8;
    var getFeaturesByGeometryService8;
    getFeaturesByBoundsParameters8 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:加油站"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService8 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted8,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService8.processAsync(getFeaturesByBoundsParameters8);
    
    var getFeaturesByBoundsParameters9;
    var getFeaturesByGeometryService9;
    getFeaturesByBoundsParameters9 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:服务区"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService9 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted9,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService9.processAsync(getFeaturesByBoundsParameters9);
    
    var getFeaturesByBoundsParameters10;
    var getFeaturesByGeometryService10;
    getFeaturesByBoundsParameters10 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:消防局"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService10 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted10,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService10.processAsync(getFeaturesByBoundsParameters10);
    
    var getFeaturesByBoundsParameters11;
    var getFeaturesByGeometryService11;
    getFeaturesByBoundsParameters11 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:t_msc"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService11 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted11,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService11.processAsync(getFeaturesByBoundsParameters11);
    
    var getFeaturesByBoundsParameters12;
    var getFeaturesByGeometryService12;
    getFeaturesByBoundsParameters12 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:t_tfc"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService12 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted12,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService12.processAsync(getFeaturesByBoundsParameters12);
    
    var getFeaturesByBoundsParameters13;
    var getFeaturesByGeometryService13;
    getFeaturesByBoundsParameters13 = new SuperMap.REST.GetFeaturesByBoundsParameters({
	    datasetNames: ["nmdata:t_disa1"],
	    spatialQueryMode:SuperMap.REST.SpatialQueryMode.INTERSECT,
	    bounds: drawGeometryArgs.feature.geometry.bounds
    });
    getFeaturesByGeometryService13 = new SuperMap.REST.GetFeaturesByBoundsService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted13,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService13.processAsync(getFeaturesByBoundsParameters13);
}

/**
 * @note 区域查询-绘完触发事件
 * @author 吴义迪
 * @create_time 2017-07-16
 */
function areaQueryDrawCompleted3(drawGeometryArgs){
	if(confirm("是否继续绘制？")){
		Global.areaQuery.continueDrawFlag = true;
	}else{
		Global.areaQuery.drawFeature3.deactivate();
		Global.areaQuery.continueDrawFlag = false;
		startDragMap();
	}
	
	//面积量算
	var measureParam = new SuperMap.REST.MeasureParameters(drawGeometryArgs.feature.geometry);
	var myMeasuerService = new SuperMap.REST.MeasureService(Global.common.iserverPath + "/iserver/services/map-world/rest/maps/World");
	myMeasuerService.events.on({ "processCompleted": measureCompleted });
	myMeasuerService.measureMode = SuperMap.REST.MeasureMode.AREA;
    myMeasuerService.processAsync(measureParam);
	
	//获得图层几何对象
	Global.areaQuery.geometry.push(drawGeometryArgs.feature.geometry);
    /* 获取普查信息 */
    var url = Global.common.iserverPath + Global.iserver.rest.data1;
    var getFeaturesByGeometryParameters;
    var getFeaturesByGeometryService;
    getFeaturesByGeometryParameters = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:乡镇级"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService.processAsync(getFeaturesByGeometryParameters);
    
    var getFeaturesByGeometryParameters1;
    var getFeaturesByGeometryService1;
    getFeaturesByGeometryParameters1 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:显示屏"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService1 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted1,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService1.processAsync(getFeaturesByGeometryParameters1);
    
    var getFeaturesByGeometryParameters2;
    var getFeaturesByGeometryService2;
    getFeaturesByGeometryParameters2 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:村级"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService2 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted2,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService2.processAsync(getFeaturesByGeometryParameters2);
    
    var getFeaturesByGeometryParameters3;
    var getFeaturesByGeometryService3;
    getFeaturesByGeometryParameters3 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:qxj"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService3 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted3,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService3.processAsync(getFeaturesByGeometryParameters3);
    
    var getFeaturesByGeometryParameters4;
    var getFeaturesByGeometryService4;
    getFeaturesByGeometryParameters4 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:学校"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService4 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted4,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService4.processAsync(getFeaturesByGeometryParameters4);
    
    var getFeaturesByGeometryParameters5;
    var getFeaturesByGeometryService5;
    getFeaturesByGeometryParameters5 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:医院"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService5 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted5,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService5.processAsync(getFeaturesByGeometryParameters5);
    
    var getFeaturesByGeometryParameters6;
    var getFeaturesByGeometryService6;
    getFeaturesByGeometryParameters6 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:发电站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService6 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted6,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService6.processAsync(getFeaturesByGeometryParameters6);
    
    var getFeaturesByGeometryParameters7;
    var getFeaturesByGeometryService7;
    getFeaturesByGeometryParameters7 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:火车站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService7 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted7,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService7.processAsync(getFeaturesByGeometryParameters7);
    
    var getFeaturesByGeometryParameters8;
    var getFeaturesByGeometryService8;
    getFeaturesByGeometryParameters8 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:加油站"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService8 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted8,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService8.processAsync(getFeaturesByGeometryParameters8);
    
    var getFeaturesByGeometryParameters9;
    var getFeaturesByGeometryService9;
    getFeaturesByGeometryParameters9 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:服务区"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService9 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted9,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService9.processAsync(getFeaturesByGeometryParameters9);
    
    var getFeaturesByGeometryParameters10;
    var getFeaturesByGeometryService10;
    getFeaturesByGeometryParameters10 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:消防局"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService10 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted10,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService10.processAsync(getFeaturesByGeometryParameters10);
    
    var getFeaturesByGeometryParameters11;
    var getFeaturesByGeometryService11;
    getFeaturesByGeometryParameters11 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_msc"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService11 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted11,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService11.processAsync(getFeaturesByGeometryParameters11);
    
    var getFeaturesByGeometryParameters12;
    var getFeaturesByGeometryService12;
    getFeaturesByGeometryParameters12 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_tfc"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService12 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted12,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService12.processAsync(getFeaturesByGeometryParameters12);
    
    var getFeaturesByGeometryParameters13;
    var getFeaturesByGeometryService13;
    getFeaturesByGeometryParameters13 = new SuperMap.REST.GetFeaturesByGeometryParameters({
	    datasetNames: ["nmdata:t_disa1"],
	    toIndex: -1,
	    spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
	    geometry: drawGeometryArgs.feature.geometry
    });
    getFeaturesByGeometryService13 = new SuperMap.REST.GetFeaturesByGeometryService(url, {
	    eventListeners: 
	    {
		    "processCompleted": areaQueryCompleted13,
		    "processFailed": areaQueryFailed
	    }
    });
    getFeaturesByGeometryService13.processAsync(getFeaturesByGeometryParameters13);
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-16
 */
function areaQueryCompleted(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.town == null){
		Global.areaQuery.features.town = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.town, result.features, ["NAME", "POINT_X", "POINT_Y"]);
		Global.areaQuery.features.town.push.apply(Global.areaQuery.features.town, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		Global.areaQuery.features.people.town = Global.areaQuery.features.town;
		$("#bxfb_town").html("镇(" + Global.areaQuery.features.town.length + ")");
		$("#bxfb_yxxz").html(Global.areaQuery.features.town.length);
		var html = "";
		for(var i=0; i<Global.areaQuery.features.town.length; i++){
			html += "<div class=\"alert alert-info alert-dismissible xian-close\" role=\"alert\" title=\""+Global.areaQuery.features.town[i].data["NAME"]+"\">" +
					"	<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\" name=\"bxfb_zhen_x\">&times;</span></button>" +
					"	<strong class=\"bxfb_strong\">"+Global.areaQuery.features.town[i].data["NAME"]+"</strong>" +
					"</div>";
		}
		$("#zhen").html(html);
		if(Global.areaQuery.features.people.town != null && Global.areaQuery.features.people.village != null){
			$("#contactpeople_span").html("责任人：" + (Global.areaQuery.features.people.town.length + Global.areaQuery.features.people.village.length));
			$("#bxfb_people").html((Global.areaQuery.features.people.town.length + Global.areaQuery.features.people.village.length));
			showContactPeopleClusterLayer("query_31", "5", ["#6A5ACD","resources/images/people_1.png","resources/images/people_2.png"]);
		}
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-18
 */
function areaQueryCompleted1(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.display == null){
		Global.areaQuery.features.display = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.display, result.features, ["F1"]);
		Global.areaQuery.features.display.push.apply(Global.areaQuery.features.display, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#tool_div").hide();
		$("#header_menus_title_tool").attr("flag", "1");
		$("#header_menus_title_tool").attr("src", "resources/images/tool_checked.png");
		$("#display_span").html("显示屏:"+Global.areaQuery.features.display.length);
		$("#bxfb_display").html(Global.areaQuery.features.display.length);
		$("#bxfb_div").show();
		showAreaQueryClusterLayer("query_30", Global.areaQuery.features.display, "5", ["正常","不正常"], ["#246F32","resources/images/display_on.png","resources/images/display_off.png"]);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-18
 */
function areaQueryCompleted2(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.village == null){
		Global.areaQuery.features.village = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.village, result.features, ["NAME", "POINT_X", "POINT_Y"]);
		Global.areaQuery.features.village.push.apply(Global.areaQuery.features.village, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		Global.areaQuery.features.people.village = Global.areaQuery.features.village;
		$("#bxfb_village").html("村(" + Global.areaQuery.features.village.length + ")");
		$("#bxfb_yxxc").html(Global.areaQuery.features.village.length);
		var html = "";
		for(var i=0; i<Global.areaQuery.features.village.length; i++){
			html += "<div class=\"alert alert-info alert-dismissible xian-close\" role=\"alert\" title=\""+Global.areaQuery.features.village[i].data["NAME"]+"\">" +
					"	<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\" name=\"bxfb_cun_x\">&times;</span></button>" +
					"	<strong class=\"bxfb_strong\">"+Global.areaQuery.features.village[i].data["NAME"]+"</strong>" +
					"</div>";
		}
		$("#cun").html(html);
		if(Global.areaQuery.features.people.town != null && Global.areaQuery.features.people.village != null){
			$("#contactpeople_span").html("责任人:" + (Global.areaQuery.features.people.town.length + Global.areaQuery.features.people.village.length));
			$("#bxfb_people").html((Global.areaQuery.features.people.town.length + Global.areaQuery.features.people.village.length));
			showContactPeopleClusterLayer("query_31", "5", ["#6A5ACD","resources/images/people_1.png","resources/images/people_2.png"]);
		}
		var peopleNum = countPeople();
		$("#bxfb_yxrk").html(peopleNum);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-18
 */
function areaQueryCompleted3(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.cnty == null){
		Global.areaQuery.features.cnty = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.cnty, result.features, ["XIANNAME"]);
		Global.areaQuery.features.cnty.push.apply(Global.areaQuery.features.cnty, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_cnty").html("县(" + Global.areaQuery.features.cnty.length + ")");
		$("#bxfb_yxxs").html(Global.areaQuery.features.cnty.length);
		var html = "";
		for(var i=0; i<Global.areaQuery.features.cnty.length; i++){
			html += "<div class=\"alert alert-info alert-dismissible xian-close\" role=\"alert\" code=\""+Global.areaQuery.features.cnty[i].data["XIANCODE"]+"\" title=\""+Global.areaQuery.features.cnty[i].data["XIANNAME"]+"\">" +
					"	<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\" name=\"bxfb_xian_x\">&times;</span></button>" +
					"	<strong class=\"bxfb_strong\">"+Global.areaQuery.features.cnty[i].data["XIANNAME"]+"</strong>" +
					"</div>";
		}
		$("#xian").html(html);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-19
 */
function areaQueryCompleted4(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	var f1 = [];
	var f2 = [];
	var f3 = [];
	var f4 = [];
	var f5 = [];
	for(var i=0; i<result.features.length; i++){
		if(result.features[i].data["TYPE"] == "幼儿园"){
			f1.push(result.features[i]);
		}else if(result.features[i].data["TYPE"] == "小学"){
			f2.push(result.features[i]);
		}else if(result.features[i].data["TYPE"] == "中学"){
			f3.push(result.features[i]);
		}else if(result.features[i].data["TYPE"] == "职业技术学校"){
			f4.push(result.features[i]);
		}else if(result.features[i].data["TYPE"] == "高等院校"){
			f5.push(result.features[i]);
		}
	}
	if(Global.areaQuery.features.school1 == null){
		Global.areaQuery.features.school1 = f1;
		Global.areaQuery.features.school2 = f2;
		Global.areaQuery.features.school3 = f3;
		Global.areaQuery.features.school4 = f4;
		Global.areaQuery.features.school5 = f5;
	}else{
		var featureArr1 = removeRepeatData(Global.areaQuery.features.school1, f1, ["NAME","LON","LAT"]);
		var featureArr2 = removeRepeatData(Global.areaQuery.features.school2, f2, ["NAME","LON","LAT"]);
		var featureArr3 = removeRepeatData(Global.areaQuery.features.school3, f3, ["NAME","LON","LAT"]);
		var featureArr4 = removeRepeatData(Global.areaQuery.features.school4, f4, ["NAME","LON","LAT"]);
		var featureArr5 = removeRepeatData(Global.areaQuery.features.school5, f5, ["NAME","LON","LAT"]);
		Global.areaQuery.features.school1.push.apply(Global.areaQuery.features.school1, featureArr1);
		Global.areaQuery.features.school2.push.apply(Global.areaQuery.features.school2, featureArr2);
		Global.areaQuery.features.school3.push.apply(Global.areaQuery.features.school3, featureArr3);
		Global.areaQuery.features.school4.push.apply(Global.areaQuery.features.school4, featureArr4);
		Global.areaQuery.features.school5.push.apply(Global.areaQuery.features.school5, featureArr5);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_school1").html(Global.areaQuery.features.school1.length);
		$("#bxfb_school2").html(Global.areaQuery.features.school2.length);
		$("#bxfb_school3").html(Global.areaQuery.features.school3.length);
		$("#bxfb_school4").html(Global.areaQuery.features.school4.length);
		$("#bxfb_school5").html(Global.areaQuery.features.school5.length);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-19
 */
function areaQueryCompleted5(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	var f1 = [];
	var f2 = [];
	var f3 = [];
	for(var i=0; i<result.features.length; i++){
		if(result.features[i].data["TYPE"] == "综合医院"){
			f1.push(result.features[i]);
		}else if(result.features[i].data["TYPE"] == "专科医院"){
			f2.push(result.features[i]);
		}else if(result.features[i].data["TYPE"] == "诊所"){
			f3.push(result.features[i]);
		}
	}
	if(Global.areaQuery.features.hospital1 == null){
		Global.areaQuery.features.hospital1 = f1;
		Global.areaQuery.features.hospital2 = f2;
		Global.areaQuery.features.hospital3 = f3;
	}else{
		var featureArr1 = removeRepeatData(Global.areaQuery.features.hospital1, f1, ["NAME","LON","LAT"]);
		var featureArr2 = removeRepeatData(Global.areaQuery.features.hospital2, f2, ["NAME","LON","LAT"]);
		var featureArr3 = removeRepeatData(Global.areaQuery.features.hospital3, f3, ["NAME","LON","LAT"]);
		Global.areaQuery.features.hospital1.push.apply(Global.areaQuery.features.hospital1, featureArr1);
		Global.areaQuery.features.hospital2.push.apply(Global.areaQuery.features.hospital2, featureArr2);
		Global.areaQuery.features.hospital3.push.apply(Global.areaQuery.features.hospital3, featureArr3);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_hospital1").html(Global.areaQuery.features.hospital1.length);
		$("#bxfb_hospital2").html(Global.areaQuery.features.hospital2.length);
		$("#bxfb_hospital3").html(Global.areaQuery.features.hospital3.length);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-19
 */
function areaQueryCompleted6(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.powerStation == null){
		Global.areaQuery.features.powerStation = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.powerStation, result.features, ["NAME","LON","LAT"]);
		Global.areaQuery.features.powerStation.push.apply(Global.areaQuery.features.powerStation, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_powerStation").html(Global.areaQuery.features.powerStation.length);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-19
 */
function areaQueryCompleted7(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.railway == null){
		Global.areaQuery.features.railway = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.railway, result.features, ["NAME","LON","LAT"]);
		Global.areaQuery.features.railway.push.apply(Global.areaQuery.features.railway, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_railway").html(Global.areaQuery.features.railway.length);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-20
 */
function areaQueryCompleted8(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.gasStation == null){
		Global.areaQuery.features.gasStation = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.gasStation, result.features, ["NAME","LON","LAT"]);
		Global.areaQuery.features.gasStation.push.apply(Global.areaQuery.features.gasStation, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_gasStation").html(Global.areaQuery.features.gasStation.length);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-20
 */
function areaQueryCompleted9(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.restArea == null){
		Global.areaQuery.features.restArea = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.restArea, result.features, ["NAME","LON","LAT"]);
		Global.areaQuery.features.restArea.push.apply(Global.areaQuery.features.restArea, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_restArea").html(Global.areaQuery.features.restArea.length);
	}
}

/**
 * @note 区域查询-普查信息-结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-20
 */
function areaQueryCompleted10(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.fireStation == null){
		Global.areaQuery.features.fireStation = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.fireStation, result.features, ["NAME","LON","LAT"]);
		Global.areaQuery.features.fireStation.push.apply(Global.areaQuery.features.fireStation, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_fireStation").html(Global.areaQuery.features.fireStation.length);
	}
}

/**
 * @note 区域查询-中小河流隐患点-结束调用事件
 * @author 吴义迪
 * @create_time 2017-08-01
 */
function areaQueryCompleted11(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.hidden1 == null){
		Global.areaQuery.features.hidden1 = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.hidden1, result.features, ["F1"]);
		Global.areaQuery.features.hidden1.push.apply(Global.areaQuery.features.hidden1, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_hidden1").html(Global.areaQuery.features.hidden1.length);
	}
}

/**
 * @note 区域查询-山洪隐患点-结束调用事件
 * @author 吴义迪
 * @create_time 2017-08-01
 */
function areaQueryCompleted12(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	if(Global.areaQuery.features.hidden2 == null){
		Global.areaQuery.features.hidden2 = result.features;
	}else{
		var featureArr = removeRepeatData(Global.areaQuery.features.hidden2, result.features, ["F1"]);
		Global.areaQuery.features.hidden2.push.apply(Global.areaQuery.features.hidden2, featureArr);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_hidden2").html(Global.areaQuery.features.hidden2.length);
	}
}

/**
 * @note 区域查询-预警点-结束调用事件
 * @author 吴义迪
 * @create_time 2017-08-01
 */
function areaQueryCompleted13(getFeaturesEventArgs){
	var result = getFeaturesEventArgs.result;
	var f1 = [];
	var f2 = [];
	var f3 = [];
	var f4 = [];
	for(var i=0; i<result.features.length; i++){
		if(result.features[i].data["F5"] == "中小河流"){
			f1.push(result.features[i]);
		}else if(result.features[i].data["F5"] == "山洪"){
			f2.push(result.features[i]);
		}else if(result.features[i].data["F5"] == "泥石流"){
			f3.push(result.features[i]);
		}else if(result.features[i].data["F5"] == "滑坡"){
			f4.push(result.features[i]);
		}
	}
	if(Global.areaQuery.features.alarms1 == null){
		Global.areaQuery.features.alarms1 = f1;
		Global.areaQuery.features.alarms2 = f2;
		Global.areaQuery.features.alarms3 = f3;
		Global.areaQuery.features.alarms4 = f4;
	}else{
		var featureArr1 = removeRepeatData(Global.areaQuery.features.alarms1, f1, ["F3"]);
		var featureArr2 = removeRepeatData(Global.areaQuery.features.alarms2, f2, ["F3"]);
		var featureArr3 = removeRepeatData(Global.areaQuery.features.alarms3, f3, ["F3"]);
		var featureArr4 = removeRepeatData(Global.areaQuery.features.alarms4, f4, ["F3"]);
		
		Global.areaQuery.features.alarms1.push.apply(Global.areaQuery.features.alarms1, featureArr1);
		Global.areaQuery.features.alarms2.push.apply(Global.areaQuery.features.alarms2, featureArr2);
		Global.areaQuery.features.alarms3.push.apply(Global.areaQuery.features.alarms3, featureArr3);
		Global.areaQuery.features.alarms4.push.apply(Global.areaQuery.features.alarms4, featureArr4);
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_alarms1").html(Global.areaQuery.features.alarms1.length);
		$("#bxfb_alarms2").html(Global.areaQuery.features.alarms2.length);
		$("#bxfb_alarms3").html(Global.areaQuery.features.alarms3.length);
		$("#bxfb_alarms4").html(Global.areaQuery.features.alarms4.length);
	}
}

/**
 * @note 去重数据
 * @author 吴义迪
 * @create_time 2017-07-18
 */
function removeRepeatData(source, dest, paramArr){
	var featureArr = [];
	for(var i=0; i<dest.length; i++){
		var flag = true;
		for(var j=0; j<source.length; j++){
			var count = 0;
			for(var k=0; k<paramArr.length; k++){
				if(dest[i].data[paramArr[k]] == source[j].data[paramArr[k]]){
					count ++;
				}
			}
			if(count == paramArr.length){
				flag = false;
				break;
			}
			if(flag == true && j == (source.length - 1)){
				featureArr.push(dest[i]);
			}
		}
	}
	return featureArr;
}

/**
 * @note 区域查询-结束调用事件失败
 * @author 吴义迪
 * @create_time 2017-07-16
 */
function areaQueryFailed(e){
	console.info(e.error.errorMsg);
}

/**
 * @note 展示区域查询聚散图数据
 * @author 吴义迪
 * @create_time 2017-07-18
 */
function showAreaQueryClusterLayer(id, value, type, levels, colors){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		var labelYOffset = 0;
		if($(window).width > 1900){
			labelYOffset = -4;
		}
		layers.push(new SuperMap.Layer.ClusterLayer("layer_"+id+"", {
			clusterStyles:[
			{ 
				"count":9,//子节点小于等于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
					strokeWidth: 0,
					fillColor: colors[0],
					pointRadius: 12,
	               	fillOpacity: 0.8,
	               	labelXOffset: 0, 
	               	labelYOffset: labelYOffset
	           } 
			},
			{ 
				"count":99,//子节点小于等于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
					strokeWidth: 0,
					fillColor: colors[0],
					pointRadius: 15,
					fillOpacity: 0.8,
	               	labelXOffset: 0, 
	               	labelYOffset: labelYOffset
	           } 
			},
			{ 
				"count":999,//子节点小于等于xx2大于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
	              	graphic:true, 
	              	strokeWidth: 0,
					fillColor: colors[0],
					pointRadius: 18,
					fillOpacity: 0.8,
	              	labelXOffset: 0, 
	              	labelYOffset: labelYOffset
	           } 
	       }, 
	       { 
	           	"count":"moreThanMax",// 子节点大于xx2的聚散点 
	           	"style":{ 
	              	fontColor:"#fff", 
	              	fontSize: "13px",
	              	graphic:true, 
	              	strokeWidth: 0,
					fillColor: colors[0],
					pointRadius: 20,
					fillOpacity: 0.8,
	              	labelXOffset: 0, 
	              	labelYOffset: labelYOffset
	           	} 
	       } 
	       ],
	       maxLevel: Config[id].maxLevel,
	       maxDiffuseAmount: Config[id].maxDiffuseAmount
		}));
		Global.common.map.addLayer(layers[0]);
		Global.common.selectFeatureLayers.push(layers[0]);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		Config[id].selectCluster = new SuperMap.Control.SelectCluster(layers[0], { 
		    callbacks:{ 
		    	//点击事件 
		    	click:function(f){
		    		
		        }, 
		        //鼠标移入
		        over:function(f){ 
		        	//聚散点 
		    		if(f.isCluster){ 
		    			var param = {
		    				count: f.children.length,
		    				title: Config[id].popupTitle
		    			};
		    			openClusterPopup(f, param);
		            } 
		    		//非聚散点 
		            else{ 
		            	openBasePointLayerPopup(f);
		            } 
		        }, 
		        //鼠标移出
		        out:function(f){
		            closePopup();
		        }, 
		        //双击事件 
		        dblclick:function(f){ 
		             
		        } 
		    } 
		});
		//将控件添加到地图上
		Global.common.map.addControl(Config[id].selectCluster);
	    //激活控件。
		Config[id].selectCluster.activate();
	}
	var fs = [];
	for(var i=0; i<value.length; i++){
		var point = new SuperMap.Geometry.Point(value[i].geometry.x,value[i].geometry.y).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	if(type == "5"){
    		var imgUrl = "";
    		if(levels.length == 1 && levels[0] == "-1"){
    			imgUrl = colors[1];
    		}else{
    			for(var k=0; k<levels.length; k++){
	    			if(value[i].data[Config[id].legendColumn] == levels[k]){
			    		imgUrl = colors[k+1];
			    		break;
			    	}
	    		}
    		}
	    	feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: Config[id].featureImgStyle.graphicWidth,
				graphicHeight: Config[id].featureImgStyle.graphicWidth	
			};
    	}else if(type == "6"){
    		var fillColor = "";
    		if(levels.length == 1 && levels[0] == "-1"){
    			fillColor = colors[1];
    		}else{
    			for(var k=0; k<levels.length; k++){
	    			if(value[i].data[Config[id].legendColumn] == levels[k]){
	    				fillColor = colors[k+1];
			    		break;
			    	}
	    		}
    		}
    		feature.style = {
				fillColor: fillColor,
		      	strokeColor: Config[id].featureStyle.strokeColor,
		      	strokeWidth: Config[id].featureStyle.strokeWidth,
		      	strokeOpacity: Config[id].featureStyle.strokeOpacity,
		      	pointRadius: Config[id].featureStyle.pointRadius,
		      	fillOpacity: Config[id].opacity
	    	};
    	}
    	feature.info = {};
    	feature.info.layerId = id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		//处理时间
    		if(Config[id].featurnInfo[k].date == true){
    			var date = new Date();
    			date.setTime(value[i].data[Config[id].featurnInfo[k].flag]);
    			feature.info[Config[id].featurnInfo[k].flag] = timeFormat1(date);
    		}else{
    			feature.info[Config[id].featurnInfo[k].flag] = value[i].data[Config[id].featurnInfo[k].flag];
    		}
    	}
	    fs.push(feature);
	}
	layers[0].addFeatures(fs);
}

/**
 * @note 展示区域查询点图数据
 * @author 吴义迪
 * @create_time 2017-07-21
 */
function showAreaQueryPointLayer(id, value, type, levels, colors){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		layers.push(new SuperMap.Layer.Vector("layer_"+id+""));
		Global.common.map.addLayer(layers[0]);
		Global.common.selectFeatureLayers.push(layers[0]);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	for(var i=0; i<value.length; i++){
		var point = new SuperMap.Geometry.Point(value[i].geometry.x,value[i].geometry.y).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	feature.info = {};
    	feature.info.layerId = id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		feature.info[Config[id].featurnInfo[k].flag] = value[i].data[Config[id].featurnInfo[k].flag];
    	}
		//图片类型
		if(type == "2"){
    		var imgUrl = "";
    		if(levels.length == 1 && levels[0] == "-1"){
    			imgUrl = colors[0];
    		}else{
    			
    		}
    		feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: Config[id].featureImgStyle.graphicWidth,
				graphicHeight: Config[id].featureImgStyle.graphicWidth	
			};
    	}
		//点类型
		else if(type == "1" || type == "3"){
			var fillColor = "";
    		if(levels.length == 1 && levels[0] == "-1"){
    			fillColor = colors[0];
    		}else{
    			
    		}
			feature.style = {
				fillColor: fillColor,
		      	strokeColor: Config[id].featureStyle.strokeColor,
		      	strokeWidth: Config[id].featureStyle.strokeWidth,
		      	strokeOpacity: Config[id].featureStyle.strokeOpacity,
		      	pointRadius: Config[id].featureStyle.pointRadius,
		      	fillOpacity: Config[id].featureStyle.fillOpacity
	    	};
		}
	    fs.push(feature);
	}
	layers[0].addFeatures(fs);
}

/**
 * @note 展示区域查询乡镇/村联系人聚散图数据
 * @author 吴义迪
 * @create_time 2017-07-19
 */
function showContactPeopleClusterLayer(id, type, colors){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		var labelYOffset = 0;
		if($(window).width > 1900){
			labelYOffset = -4;
		}
		layers.push(new SuperMap.Layer.ClusterLayer("layer_"+id+"", {
			clusterStyles:[
			{ 
				"count":9,//子节点小于等于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
					strokeWidth: 0,
					fillColor: colors[0],
					pointRadius: 12,
	               	fillOpacity: 0.8,
	               	labelXOffset: 0, 
	               	labelYOffset: labelYOffset
	           } 
			},
			{ 
				"count":99,//子节点小于等于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
					strokeWidth: 0,
					fillColor: colors[0],
					pointRadius: 15,
					fillOpacity: 0.8,
	               	labelXOffset: 0, 
	               	labelYOffset: labelYOffset
	           } 
			},
			{ 
				"count":999,//子节点小于等于xx2大于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
	              	graphic:true, 
	              	strokeWidth: 0,
					fillColor: colors[0],
					pointRadius: 18,
					fillOpacity: 0.8,
	              	labelXOffset: 0, 
	              	labelYOffset: labelYOffset
	           } 
	       }, 
	       { 
	           	"count":"moreThanMax",// 子节点大于xx2的聚散点 
	           	"style":{ 
	              	fontColor:"#fff", 
	              	fontSize: "13px",
	              	graphic:true, 
	              	strokeWidth: 0,
					fillColor: colors[0],
					pointRadius: 20,
					fillOpacity: 0.8,
	              	labelXOffset: 0, 
	              	labelYOffset: labelYOffset
	           	} 
	       } 
	       ],
	       maxLevel: Config[id].maxLevel,
	       maxDiffuseAmount: Config[id].maxDiffuseAmount
		}));
		Global.common.map.addLayer(layers[0]);
		Global.common.selectFeatureLayers.push(layers[0]);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		Config[id].selectCluster = new SuperMap.Control.SelectCluster(layers[0], { 
		    callbacks:{ 
		    	//点击事件 
		    	click:function(f){
		    		
		        }, 
		        //鼠标移入
		        over:function(f){ 
		        	//聚散点 
		    		if(f.isCluster){ 
		    			var param = {
		    				count: f.children.length,
		    				title: Config[id].popupTitle
		    			};
		    			openClusterPopup(f, param);
		            } 
		    		//非聚散点 
		            else{ 
		            	openBasePointLayerPopup(f);
		            } 
		        }, 
		        //鼠标移出
		        out:function(f){
		            closePopup();
		        }, 
		        //双击事件 
		        dblclick:function(f){ 
		             
		        } 
		    } 
		});
		//将控件添加到地图上
		Global.common.map.addControl(Config[id].selectCluster);
	    //激活控件。
		Config[id].selectCluster.activate();
	}
	var fs = [];
	for(var i=0; i<Global.areaQuery.features.people.town.length; i++){
		var point = new SuperMap.Geometry.Point(Global.areaQuery.features.people.town[i].geometry.x,Global.areaQuery.features.people.town[i].geometry.y).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	if(type == "5"){
    		var imgUrl = colors[1];
	    	feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: Config[id].featureImgStyle.graphicWidth,
				graphicHeight: Config[id].featureImgStyle.graphicWidth	
			};
    	}else if(type == "6"){
    		var fillColor = colors[1];
    		feature.style = {
				fillColor: fillColor,
		      	strokeColor: Config[id].featureStyle.strokeColor,
		      	strokeWidth: Config[id].featureStyle.strokeWidth,
		      	strokeOpacity: Config[id].featureStyle.strokeOpacity,
		      	pointRadius: Config[id].featureStyle.pointRadius,
		      	fillOpacity: Config[id].opacity
	    	};
    	}
    	feature.info = {};
    	feature.info.layerId = id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		//处理时间
    		if(Config[id].featurnInfo[k].flag == "level"){
    			feature.info[Config[id].featurnInfo[k].flag] = "乡镇级";
    		}else{
    			feature.info[Config[id].featurnInfo[k].flag] = Global.areaQuery.features.people.town[i].data[Config[id].featurnInfo[k].flag];
    		}
    	}
	    fs.push(feature);
	}
	for(var i=0; i<Global.areaQuery.features.people.village.length; i++){
		var point = new SuperMap.Geometry.Point(Global.areaQuery.features.people.village[i].geometry.x,Global.areaQuery.features.people.village[i].geometry.y).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	if(type == "5"){
    		var imgUrl = colors[2];
	    	feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: Config[id].featureImgStyle.graphicWidth,
				graphicHeight: Config[id].featureImgStyle.graphicWidth	
			};
    	}else if(type == "6"){
    		var fillColor = colors[2];
    		feature.style = {
				fillColor: fillColor,
		      	strokeColor: Config[id].featureStyle.strokeColor,
		      	strokeWidth: Config[id].featureStyle.strokeWidth,
		      	strokeOpacity: Config[id].featureStyle.strokeOpacity,
		      	pointRadius: Config[id].featureStyle.pointRadius,
		      	fillOpacity: Config[id].opacity
	    	};
    	}
    	feature.info = {};
    	feature.info.layerId = id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		//处理时间
    		if(Config[id].featurnInfo[k].flag == "level"){
    			feature.info[Config[id].featurnInfo[k].flag] = "村级";
    		}else{
    			feature.info[Config[id].featurnInfo[k].flag] = Global.areaQuery.features.people.village[i].data[Config[id].featurnInfo[k].flag];
    		}
    	}
	    fs.push(feature);
	}
	layers[0].addFeatures(fs);
}

/**
 * @note 统计人口数（村级）
 * @author 吴义迪
 * @create_time 2017-07-19
 */
function countPeople(){
	var result = 0;
	for(var i=0; i<Global.areaQuery.features.people.village.length; i++){
		var value = Global.areaQuery.features.people.village[i];
		if(value.data["人口"] != null && !isNaN(value.data["人口"])){
			result += parseInt(value.data["人口"]);
		}
	}
	return parseFloat((result/10000).toFixed(1));
}

/**
 * @note 测量面积结束调用事件
 * @author 吴义迪
 * @create_time 2017-07-19
 */
function measureCompleted(measureEventArgs) {
	var area = parseFloat((measureEventArgs.result.area/1000000).toFixed(1));
	if(Global.areaQuery.area == null){
		Global.areaQuery.area = area;
	}else{
		Global.areaQuery.area += area;
	}
	if(Global.areaQuery.continueDrawFlag == false){
		$("#bxfb_yxmj").html(Global.areaQuery.area.toFixed(1));
	}
}

/**
 * @note 靶向发布点击事件
 * @author 吴义迪
 * @create_time 2017-07-20
 */
function bxfbClickFunc(e){
	e = e || window.event;
	if(e.target.attributes.name && e.target.attributes.name.nodeValue == "glyphicon_eye"){
		if(e.target.id == "bxfb_school1_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_school1_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), false);
				closeLayer("query_32");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_school1_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), true);
				showAreaQueryClusterLayer("query_32", Global.areaQuery.features.school1, "5", ["-1"], ["#87CEFA","resources/images/youeryuan.png"]);
			}
		}else if(e.target.id == "bxfb_school2_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_school2_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), false);
				closeLayer("query_33");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_school2_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), true);
				showAreaQueryClusterLayer("query_33", Global.areaQuery.features.school2, "5", ["-1"], ["#00BFFF","resources/images/school_1.png"]);
			}
		}else if(e.target.id == "bxfb_school3_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_school3_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), false);
				closeLayer("query_34");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_school3_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), true);
				showAreaQueryClusterLayer("query_34", Global.areaQuery.features.school3, "5", ["-1"], ["#1E90FF","resources/images/zhonxue.png"]);
			}
		}else if(e.target.id == "bxfb_school4_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_school4_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), false);
				closeLayer("query_36");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_school4_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), true);
				showAreaQueryClusterLayer("query_36", Global.areaQuery.features.school4, "5", ["-1"], ["#0000CD","resources/images/gaozhi.png"]);
			}
		}else if(e.target.id == "bxfb_school5_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_school5_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), false);
				closeLayer("query_35");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_school5_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), true);
				showAreaQueryClusterLayer("query_35", Global.areaQuery.features.school5, "5", ["-1"], ["#000080","resources/images/gaodengSchool.png"]);
			}
		}else if(e.target.id == "bxfb_display_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_display_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_fbqd_panel span[name='glyphicon_eye']"), $("#bxfb_fbqd_eye"), false);
				closeLayer("query_30");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_display_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_fbqd_panel span[name='glyphicon_eye']"), $("#bxfb_fbqd_eye"), true);
				showAreaQueryClusterLayer("query_30", Global.areaQuery.features.display, "5", ["正常","不正常"], ["#246F32","resources/images/display_on.png","resources/images/display_off.png"]);
			}
		}else if(e.target.id == "bxfb_people_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_people_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_fbqd_panel span[name='glyphicon_eye']"), $("#bxfb_fbqd_eye"), false);
				closeLayer("query_31");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_people_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_fbqd_panel span[name='glyphicon_eye']"), $("#bxfb_fbqd_eye"), true);
				showContactPeopleClusterLayer("query_31", "5", ["#6A5ACD","resources/images/people_1.png","resources/images/people_2.png"]);
			}
		}else if(e.target.id == "bxfb_powerStation_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_powerStation_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), false);
				closeLayer("query_37");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_powerStation_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), true);
				showAreaQueryClusterLayer("query_37", Global.areaQuery.features.powerStation, "5", ["光伏电站","风电站"], ["#4682B4","resources/images/powerStation_1.png","resources/images/powerStation_2.png"]);
			}
		}else if(e.target.id == "bxfb_railway_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_railway_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), false);
				closeLayer("query_38");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_railway_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_shjj_panel span[name='glyphicon_eye']"), $("#bxfb_shjj_eye"), true);
				showAreaQueryPointLayer("query_38", Global.areaQuery.features.railway, "3", ["-1"], ["#ff0000"]);
			}
		}else if(e.target.id == "bxfb_gasStation_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_gasStation_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), false);
				closeLayer("query_39");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_gasStation_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), true);
				showAreaQueryClusterLayer("query_39", Global.areaQuery.features.gasStation, "5", ["-1"], ["#FF8C00","resources/images/gas_station.png"]);
			}
		}else if(e.target.id == "bxfb_restArea_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_restArea_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), false);
				closeLayer("query_40");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_restArea_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), true);
				showAreaQueryClusterLayer("query_40", Global.areaQuery.features.restArea, "5", ["-1"], ["#3CB371","resources/images/restArea.png"]);
			}
		}else if(e.target.id == "bxfb_fireStation_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_fireStation_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), false);
				closeLayer("query_41");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_fireStation_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), true);
				showAreaQueryClusterLayer("query_41", Global.areaQuery.features.fireStation, "5", ["-1"], ["#DC143C","resources/images/xiaofang.png"]);
			}
		}else if(e.target.id == "bxfb_hospital1_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_hospital1_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), false);
				closeLayer("query_42");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_hospital1_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), true);
				showAreaQueryClusterLayer("query_42", Global.areaQuery.features.hospital1, "5", ["-1"], ["#FF1493","resources/images/zonheyiyuan.png"]);
			}
		}else if(e.target.id == "bxfb_hospital2_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_hospital2_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), false);
				closeLayer("query_43");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_hospital2_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), true);
				showAreaQueryClusterLayer("query_43", Global.areaQuery.features.hospital2, "5", ["-1"], ["#FF69B4","resources/images/zhuankeyiyuan.png"]);
			}
		}else if(e.target.id == "bxfb_hospital3_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_hospital3_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), false);
				closeLayer("query_44");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_hospital3_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_kzt_panel span[name='glyphicon_eye']"), $("#bxfb_kzt_eye"), true);
				showAreaQueryClusterLayer("query_44", Global.areaQuery.features.hospital3, "5", ["-1"], ["#FF9BB4","resources/images/zhengsuo.png"]);
			}
		}else if(e.target.id == "bxfb_hidden1_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_hidden1_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_hidden1_eye"), false);
				closeLayer("query_45");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_hidden1_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_hidden1_eye"), true);
				showAreaQueryClusterLayer("query_45", Global.areaQuery.features.hidden1, "5", ["-1"], ["#A52A2A","resources/images/hidden_msc.png"]);
			}
		}else if(e.target.id == "bxfb_hidden2_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_hidden2_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_hidden2_eye"), false);
				closeLayer("query_46");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_hidden2_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_hidden2_eye"), true);
				showAreaQueryClusterLayer("query_46", Global.areaQuery.features.hidden2, "5", ["-1"], ["#ff0000","resources/images/hidden_tsf.png"]);
			}
		}else if(e.target.id == "bxfb_alarms1_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_alarms1_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_alarms1_eye"), false);
				closeLayer("query_47");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_alarms1_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_alarms1_eye"), true);
				showAreaQueryClusterLayer("query_47", Global.areaQuery.features.alarms1, "5", ["-1"], ["#FF4500","resources/images/alarms_1.png"]);
			}
		}else if(e.target.id == "bxfb_alarms2_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_alarms2_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_alarms2_eye"), false);
				closeLayer("query_48");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_alarms2_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_alarms2_eye"), true);
				showAreaQueryClusterLayer("query_48", Global.areaQuery.features.alarms2, "5", ["-1"], ["#CD5C5C","resources/images/alarms_2.png"]);
			}
		}else if(e.target.id == "bxfb_alarms3_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_alarms3_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_alarms3_eye"), false);
				closeLayer("query_49");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_alarms3_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_alarms3_eye"), true);
				showAreaQueryClusterLayer("query_49", Global.areaQuery.features.alarms3, "5", ["-1"], ["#8B4513","resources/images/alarms_3.png"]);
			}
		}else if(e.target.id == "bxfb_alarms4_eye"){
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_alarms4_eye").removeClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_alarms4_eye"), false);
				closeLayer("query_50");
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_alarms4_eye").addClass("ele_active");
				bxfuEyeControl($("#bxfb_yzhj_panel span[name='glyphicon_eye']"), $("#bxfb_alarms4_eye"), true);
				showAreaQueryClusterLayer("query_50", Global.areaQuery.features.alarms4, "5", ["-1"], ["#DAA520","resources/images/alarms_4.png"]);
			}
		}
	}else if(e.target.attributes.name && e.target.attributes.name.nodeValue == "glyphicon_eye_all"){
		if(e.target.id == "bxfb_shjj_eye"){
			var $value = $("#bxfb_shjj_panel span[name='glyphicon_eye']");
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_shjj_eye").removeClass("ele_active");
				for(var i=0; i<$value.length; i++){
					if($value.eq(i).attr("flag") == "1"){
						$value.eq(i).attr("flag", "0");
						$value.eq(i).removeClass("ele_active");
						if($value.eq(i).attr("id") == "bxfb_school1_eye"){
							closeLayer("query_32");
						}else if($value.eq(i).attr("id") == "bxfb_school2_eye"){
							closeLayer("query_33");
						}else if($value.eq(i).attr("id") == "bxfb_school3_eye"){
							closeLayer("query_34");
						}else if($value.eq(i).attr("id") == "bxfb_school4_eye"){
							closeLayer("query_36");
						}else if($value.eq(i).attr("id") == "bxfb_school5_eye"){
							closeLayer("query_35");
						}else if($value.eq(i).attr("id") == "bxfb_powerStation_eye"){
							closeLayer("query_37");
						}else if($value.eq(i).attr("id") == "bxfb_railway_eye"){
							closeLayer("query_38");
						}
					}
				}
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_shjj_eye").addClass("ele_active");
				for(var i=0; i<$value.length; i++){
					if($value.eq(i).attr("flag") == "0"){
						$value.eq(i).attr("flag", "1");
						$value.eq(i).addClass("ele_active");
						if($value.eq(i).attr("id") == "bxfb_school1_eye"){
							showAreaQueryClusterLayer("query_32", Global.areaQuery.features.school1, "5", ["-1"], ["#87CEFA","resources/images/youeryuan.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_school2_eye"){
							showAreaQueryClusterLayer("query_33", Global.areaQuery.features.school2, "5", ["-1"], ["#00BFFF","resources/images/school_1.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_school3_eye"){
							showAreaQueryClusterLayer("query_34", Global.areaQuery.features.school3, "5", ["-1"], ["#1E90FF","resources/images/zhonxue.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_school4_eye"){
							showAreaQueryClusterLayer("query_36", Global.areaQuery.features.school4, "5", ["-1"], ["#0000CD","resources/images/gaozhi.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_school5_eye"){
							showAreaQueryClusterLayer("query_35", Global.areaQuery.features.school5, "5", ["-1"], ["#000080","resources/images/gaodengSchool.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_powerStation_eye"){
							showAreaQueryClusterLayer("query_37", Global.areaQuery.features.powerStation, "5", ["光伏电站","风电站"], ["#4682B4","resources/images/powerStation_1.png","resources/images/powerStation_2.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_railway_eye"){
							showAreaQueryPointLayer("query_38", Global.areaQuery.features.railway, "3", ["-1"], ["#ff0000"]);
						}
					}
				}
			}
		}else if(e.target.id == "bxfb_kzt_eye"){
			var $value = $("#bxfb_kzt_panel span[name='glyphicon_eye']");
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_kzt_eye").removeClass("ele_active");
				for(var i=0; i<$value.length; i++){
					if($value.eq(i).attr("flag") == "1"){
						$value.eq(i).attr("flag", "0");
						$value.eq(i).removeClass("ele_active");
						if($value.eq(i).attr("id") == "bxfb_display_eye"){
							closeLayer("query_30");
						}else if($value.eq(i).attr("id") == "bxfb_people_eye"){
							closeLayer("query_31");
						}else if($value.eq(i).attr("id") == "bxfb_gasStation_eye"){
							closeLayer("query_39");
						}else if($value.eq(i).attr("id") == "bxfb_restArea_eye"){
							closeLayer("query_40");
						}else if($value.eq(i).attr("id") == "bxfb_fireStation_eye"){
							closeLayer("query_41");
						}else if($value.eq(i).attr("id") == "bxfb_hospital1_eye"){
							closeLayer("query_42");
						}else if($value.eq(i).attr("id") == "bxfb_hospital2_eye"){
							closeLayer("query_43");
						}else if($value.eq(i).attr("id") == "bxfb_hospital3_eye"){
							closeLayer("query_44");
						}
					}
				}
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_kzt_eye").addClass("ele_active");
				for(var i=0; i<$value.length; i++){
					if($value.eq(i).attr("flag") == "0"){
						$value.eq(i).attr("flag", "1");
						$value.eq(i).addClass("ele_active");
						if($value.eq(i).attr("id") == "bxfb_display_eye"){
							showAreaQueryClusterLayer("query_30", Global.areaQuery.features.display, "5", ["正常","不正常"], ["#246F32","resources/images/display_on.png","resources/images/display_off.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_people_eye"){
							showContactPeopleClusterLayer("query_31", "5", ["#6A5ACD","resources/images/people_1.png","resources/images/people_2.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_gasStation_eye"){
							showAreaQueryClusterLayer("query_39", Global.areaQuery.features.gasStation, "5", ["-1"], ["#FF8C00","resources/images/gas_station.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_restArea_eye"){
							showAreaQueryClusterLayer("query_40", Global.areaQuery.features.restArea, "5", ["-1"], ["#3CB371","resources/images/restArea.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_fireStation_eye"){
							showAreaQueryClusterLayer("query_41", Global.areaQuery.features.fireStation, "5", ["-1"], ["#DC143C","resources/images/xiaofang.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_hospital1_eye"){
							showAreaQueryClusterLayer("query_42", Global.areaQuery.features.hospital1, "5", ["-1"], ["#FF1493","resources/images/zonheyiyuan.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_hospital2_eye"){
							showAreaQueryClusterLayer("query_43", Global.areaQuery.features.hospital2, "5", ["-1"], ["#FF69B4","resources/images/zhuankeyiyuan.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_hospital3_eye"){
							showAreaQueryClusterLayer("query_44", Global.areaQuery.features.hospital3, "5", ["-1"], ["#FF9BB4","resources/images/zhengsuo.png"]);
						}
					}
				}
			}
		}else if(e.target.id == "bxfb_yzhj_eye"){
			var $value = $("#bxfb_yzhj_panel span[name='glyphicon_eye']");
			if(e.target.attributes.flag && e.target.attributes.flag.nodeValue == "1"){
				e.target.attributes.flag.nodeValue = "0";
				$("#bxfb_yzhj_eye").removeClass("ele_active");
				for(var i=0; i<$value.length; i++){
					if($value.eq(i).attr("flag") == "1"){
						$value.eq(i).attr("flag", "0");
						$value.eq(i).removeClass("ele_active");
						if($value.eq(i).attr("id") == "bxfb_hidden1_eye"){
							closeLayer("query_45");
						}else if($value.eq(i).attr("id") == "bxfb_hidden2_eye"){
							closeLayer("query_46");
						}else if($value.eq(i).attr("id") == "bxfb_alarms1_eye"){
							closeLayer("query_47");
						}else if($value.eq(i).attr("id") == "bxfb_alarms2_eye"){
							closeLayer("query_48");
						}else if($value.eq(i).attr("id") == "bxfb_alarms3_eye"){
							closeLayer("query_49");
						}else if($value.eq(i).attr("id") == "bxfb_alarms4_eye"){
							closeLayer("query_50");
						}
					}
				}
			}else{
				e.target.attributes.flag.nodeValue = "1";
				$("#bxfb_yzhj_eye").addClass("ele_active");
				for(var i=0; i<$value.length; i++){
					if($value.eq(i).attr("flag") == "0"){
						$value.eq(i).attr("flag", "1");
						$value.eq(i).addClass("ele_active");
						if($value.eq(i).attr("id") == "bxfb_hidden1_eye"){
							showAreaQueryClusterLayer("query_45", Global.areaQuery.features.hidden1, "5", ["-1"], ["#A52A2A","resources/images/hidden_msc.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_hidden2_eye"){
							showAreaQueryClusterLayer("query_46", Global.areaQuery.features.hidden2, "5", ["-1"], ["#ff0000","resources/images/hidden_tsf.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_alarms1_eye"){
							showAreaQueryClusterLayer("query_47", Global.areaQuery.features.alarms1, "5", ["-1"], ["#FF4500","resources/images/alarms_1.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_alarms2_eye"){
							showAreaQueryClusterLayer("query_48", Global.areaQuery.features.alarms2, "5", ["-1"], ["#CD5C5C","resources/images/alarms_2.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_alarms3_eye"){
							showAreaQueryClusterLayer("query_49", Global.areaQuery.features.alarms3, "5", ["-1"], ["#8B4513","resources/images/alarms_3.png"]);
						}else if($value.eq(i).attr("id") == "bxfb_alarms4_eye"){
							showAreaQueryClusterLayer("query_50", Global.areaQuery.features.alarms4, "5", ["-1"], ["#DAA520","resources/images/alarms_4.png"]);
						}
					}
				}
			}
		}
	}else if(e.target.attributes.name && e.target.attributes.name.nodeValue == "bxfb_xian_x"){
		$("#bxfb_cnty").html("县(" + ($("#xian>div").length-1) + ")");
	}else if(e.target.attributes.name && e.target.attributes.name.nodeValue == "bxfb_zhen_x"){
		$("#bxfb_town").html("镇(" + ($("#zhen>div").length-1) + ")");
	}else if(e.target.attributes.name && e.target.attributes.name.nodeValue == "bxfb_cun_x"){
		$("#bxfb_village").html("村(" + ($("#cun>div").length-1) + ")");
	}else if(e.target.id == "bxfb_exit"){
		bxfbExit();
	}else if(e.target.id == "bxfb_reset"){
		bxfbReset();
	}else if(e.target.id == "bxfb_sent"){
		bxfbSent();
	}else if(e.target.id == "0"){
		Global.areaQuery.layer.style = {
			strokeColor: "#ff0000",
	        strokeWidth: 2,
	        fillColor: "#ff0000",
	        fillOpacity: 0.2
	    };
		Global.areaQuery.layer.redraw();
	}else if(e.target.id == "1"){
		Global.areaQuery.layer.style = {
			strokeColor: "#ffa500",
	        strokeWidth: 2,
	        fillColor: "#ffa500",
	        fillOpacity: 0.2
	    };
		Global.areaQuery.layer.redraw();
	}else if(e.target.id == "2"){
		Global.areaQuery.layer.style = {
			strokeColor: "#ffff00",
	        strokeWidth: 2,
	        fillColor: "#ffff00",
	        fillOpacity: 0.2
	    };
		Global.areaQuery.layer.redraw();
	}else if(e.target.id == "3"){
		Global.areaQuery.layer.style = {
			strokeColor: "#0000ff",
	        strokeWidth: 2,
	        fillColor: "#0000ff",
	        fillOpacity: 0.2
	    };
		Global.areaQuery.layer.redraw();
	}else if(e.target.id == "bxfb_zhlx_input"){
		bxfbDisasterTypeClickFunc();
		//从session中加载组织单位
    	$.ajax({
             async: false,
             url: Global.common.ajaxPath+"/getSession.do",
             success: function (data){
            	var obj = eval("("+data+")");
 			    
        		for(var i=0;i<obj.length;i++){
        			var option="<option value=\""+obj[i].id+"\""; 
                    /* if(row==obj[i].value){  
                        option += " selected=\"selected\""; //默认选中    
                    } */ 
                    option += ">"+obj[i].value+"</option>";  //动态添加数据  
                    //$("#strategyName").append(option); 
                    
        		}
        		//给隐藏组织单位填充组织单位名称
        	    document.getElementById("orgName").value = obj[0].value; 
        	    //给隐藏组织单位填充内容
        	    document.getElementById("orgId").value = obj[0].id;
             },
             error: function (xhr) { alert('加载发布单位出错！'); }
	    });
		
	}
}

/**
 * @note 靶向发布图层图标控制
 * @author 吴义迪
 * @create_time 2017-07-24
 */
function bxfuEyeControl($value, $element, flag){
	if(flag == false){
		for(var i=0; i<$value.length; i++){
			if($value.eq(i).attr("flag") == "1"){
				break;
			}
			if(i == ($value.length - 1)){
				$element.attr("flag", "0");
				$element.removeClass("ele_active");
			}
		}
	}else{
		for(var i=0; i<$value.length; i++){
			if($value.eq(i).attr("flag") == "0"){
				break;
			}
			if(i == ($value.length - 1)){
				$element.attr("flag", "1");
				$element.addClass("ele_active");
			}
		}
	}
}

/**
 * @note 靶向发布退出
 * @author 吴义迪
 * @create_time 2017-07-24
 */
function bxfbExit(){
	$("#bxfb_div").hide();
	removeAreaQueryLayer();
	$("#bxfb_zhlx_input").val("");
	$(".gl").removeClass("glyphicon glyphicon-ok");
	$("#bxfb_cnty").html("县");
	$("#bxfb_town").html("镇");
	$("#bxfb_village").html("村");
	$("#xian").empty();
	$("#zhen").empty();
	$("#cun").empty();
	$("#contactpeople_span").html("责任人");
	$("#display_span").html("显示屏");
	$("#dalaba_span").html("大喇叭");
	$(".three-show .blur").removeClass("blur1");
	$("#bxfb_div .count-count").html("");
	$("#description").val("");
	$("#bxfb_div span[name='glyphicon_eye']").removeClass("ele_active");
	$("#bxfb_div span[name='glyphicon_eye']").attr("flag", "0");
	$("#bxfb_div span[name='glyphicon_eye_all']").removeClass("ele_active");
	$("#bxfb_div span[name='glyphicon_eye_all']").attr("flag", "0");
	$("#bxfb_fbqd_eye,#bxfb_display_eye,#bxfb_people_eye").attr("flag", "1");
	$("#bxfb_fbqd_eye,#bxfb_display_eye,#bxfb_people_eye").addClass("ele_active");
}

/**
 * @note 靶向发布重置
 * @author 吴义迪
 * @create_time 2017-07-24
 */
function bxfbReset(){
	Global.areaQuery.layer.style = {
		strokeColor: "#a9a9a9",
        strokeWidth: 2,
        fillColor: "#a9a9a9",
        fillOpacity: 0.2
    };
	Global.areaQuery.layer.redraw();
	$("#bxfb_zhlx_input").val("");
	$(".gl").removeClass("glyphicon glyphicon-ok");
	$("#bxfb_cnty").html("县(" + Global.areaQuery.features.cnty.length + ")");
	$("#bxfb_town").html("镇(" + Global.areaQuery.features.town.length + ")");
	$("#bxfb_village").html("村(" + Global.areaQuery.features.village.length + ")");
	$(".three-show .blur").removeClass("blur1");
	$("#description").val("");
	var html1 = "";
	for(var i=0; i<Global.areaQuery.features.cnty.length; i++){
		html1 += "<div class=\"alert alert-info alert-dismissible xian-close\" role=\"alert\" title=\""+Global.areaQuery.features.cnty[i].data["XIANNAME"]+"\">" +
				"	<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\" name=\"bxfb_xian_x\">&times;</span></button>" +
				"	<strong class=\"bxfb_strong\">"+Global.areaQuery.features.cnty[i].data["XIANNAME"]+"</strong>" +
				"</div>";
	}
	$("#xian").html(html1);
	var html2 = "";
	for(var i=0; i<Global.areaQuery.features.town.length; i++){
		html2 += "<div class=\"alert alert-info alert-dismissible xian-close\" role=\"alert\" title=\""+Global.areaQuery.features.town[i].data["NAME"]+"\">" +
				"	<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\" name=\"bxfb_zhen_x\">&times;</span></button>" +
				"	<strong class=\"bxfb_strong\">"+Global.areaQuery.features.town[i].data["NAME"]+"</strong>" +
				"</div>";
	}
	$("#zhen").html(html2);
	var html3 = "";
	for(var i=0; i<Global.areaQuery.features.village.length; i++){
		html3 += "<div class=\"alert alert-info alert-dismissible xian-close\" role=\"alert\" title=\""+Global.areaQuery.features.village[i].data["NAME"]+"\">" +
				"	<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\" name=\"bxfb_cun_x\">&times;</span></button>" +
				"	<strong class=\"bxfb_strong\">"+Global.areaQuery.features.village[i].data["NAME"]+"</strong>" +
				"</div>";
	}
	$("#cun").html(html3);
}

/**
 * @note 靶向发布发送
 * @author 吴义迪
 * @create_time 2017-07-24
 */
function bxfbSent(){
	//灾害类型ID
	var disaid = document.getElementById("menu_parent_id").value;
	//灾种名称
	var disaName = document.getElementById("bxfb_zhlx_input").value;
	//预警级别ID
	var alarmLevel1 = $(".glyphicon-ok").attr("id");
	//预警级别名称
	var alarmLevel1Name = $(".glyphicon-ok").attr("value");
	//发布单位名称
	var orgName = document.getElementById("orgName").value;
	//发布单位
	var orgId = document.getElementById("orgId").value;
	//获取策略ID
	var strategyId = document.getElementById("strategyId").value;
	//获取发布手段
	var obj = document.getElementsByClassName("blur blur1"); //选择所有name="'releaseChannelId'"的对象，返回数组 
	//取到对象数组后，我们来循环检测它是不是被选中 
	var releaseChannelIds=''; 
	for(var i=0;i<obj.length;i++){
		var ids = obj[i].id;
		if(ids!=""){
			ids = ids.substring(1,ids.length);
		}
		releaseChannelIds+=ids+","; 
	}
	releaseChannelIds = releaseChannelIds.substring(0,releaseChannelIds.length-1);
	//获取信息内容
	var description = document.getElementById("description").value;
	//获取影响区域
	var areaObj = document.getElementById("xian").childNodes;
	//class_name = "blur blur1";
	//var areaObj = document.getElementsByClassName("alert alert-info alert-dismissible xian-close");
	var scope='';
	var geocode='';
	for(var i=0;i<areaObj.length;i++){
		scope+=areaObj[i].title+","; 
		
		geocode+=areaObj[i].attributes.code.nodeValue+",";
		//geocode+="150100,"
	}
	scope = scope.substring(0,scope.length-1);
	geocode = geocode.substring(0,geocode.length-1);
	//alert("geocode: "+geocode);
	//发布时间
	var sendTime = document.getElementById("sendTime").value;
	//alert("releaseChannelIds: "+releaseChannelIds);
	//预警类型(0:实际预警；1:测试预警)
	var status1 = "1";
	//发布类型(0:首发信息；1:更新信息)
	var msgType = "0";
	
	//绘制落区经纬度信息
	var polygon = "";
	for(var p=0; p<Global.areaQuery.geometry.length; p++){
		var componentsArr = Global.areaQuery.geometry[p].components;
		if(componentsArr != null){
			for(var j=0; j<componentsArr.length; j++){
				var components = componentsArr[j].components;
				if(components != null){
					for(var k=0; k<components.length; k++){
						polygon += components[k].x + "," + components[k].y;
						if(k != (components.length - 1)){
							polygon += " ";
						}
					}
				}
				if(j != (componentsArr.length - 1)){
					polygon += " ";
				}
			}
		}
		if(p != (Global.areaQuery.geometry.length - 1)){
			polygon += ";";
		}
	}
	
	var params = {    
			disaid : disaid,
			disaName : disaName,
			severity : alarmLevel1,
			alarmLevel1Name : alarmLevel1Name,
			description : description,
			areaDesc : scope,
			geocode : geocode,
			sneder : orgName,
			orgId  : orgId,
			sendTime : sendTime,
			"status" : status1,
			msgType : msgType,
			strategyId : strategyId,
			filename : "",//文件名称
			resourcesize : "",
			releaseChannelIds : releaseChannelIds
	};
	if(polygon != ""){
		params.polygon  = polygon;
	}
	if($("#b8").attr("class").indexOf("blur1") >= 0){
		if(contactPeopleArray == null){
			var phoneNumArr = [];
			phoneNumArr = Global.areaQuery.features.people.town.concat(Global.areaQuery.features.people.village);
			var phoneNum = "";
			for(var p=0; p<phoneNumArr.length; p++){
				if(/^1[34578]\d{9}$/.test(phoneNumArr[p].data["电话号码"])){
					phoneNum += phoneNumArr[p].data["电话号码"] + ",";
				}
			}
			params.phoneNum = phoneNum.substring(0, phoneNum.length-1);
		}else{
			var phoneNum = "";
			for(var p=0; p<contactPeopleArray.length; p++){
				if(/^1[34578]\d{9}$/.test(contactPeopleArray[p]["电话号码"])){
					phoneNum += contactPeopleArray[p]["电话号码"] + ",";
				}
			}
			params.phoneNum = phoneNum.substring(0, phoneNum.length-1);
		}
		
	}
	//获取显示屏终端号
	if($("#b2").attr("class").indexOf("blur1") >= 0){
		if(displayArrayData == null){

		}else{
			var displayNumArr = "";
			for(var p=0; p<displayArrayData.length; p++){
				displayNumArr += displayArrayData[p]["F12"] + ",";
				//alert(displayArrayData[p]["F12"]);
			}
			params.displayIds1 = displayNumArr.substring(0, displayNumArr.length-1);
		}
		
	}
	//获取大喇叭终端号
	/*if($("#b1").attr("class").indexOf("blur1") >= 0){
		if(displayArrayData == null){

		}else{
			var displayNumArr = "";
			for(var p=0; p<displayArrayData.length; p++){
				displayNumArr += displayArrayData[p]["F12"] + ",";
			}
			params.displayIds = displayNumArr.substring(0, displayNumArr.length-1);
		}
		
	}*/

	if(disaid==null||disaid==""){
		alert("请选择灾害类型！");
	}else if(alarmLevel1==null||alarmLevel1==""){
		alert("请选择预警级别！");
	}else if(msgType==null||msgType==""){
		alert("请选择发布类型！");
	}else if(orgId==null||orgId==""){
		alert("请填写发布单位！");
	}else if(sendTime==null||sendTime==""){
		alert("请选择发布时间！");
	}else if(status1==null||status1==""){
		alert("请选择预警类型！");
	}else if(scope==null||scope==""){
		alert("请填写影响区域！");
	}else if(description==null||description==""){
		alert("请填写信息内容！");
	/*}else if(geocode==null||geocode==""){
		alert("请选择发布范围！");
	}else if(strategyId==null||strategyId==""){
		alert("没有匹配的策略，请选择策略！");
	}else if(geocode==null||geocode==""){
		alert("请选择发布范围！");*/
	}else{
		$.ajax({  
			url:Global.common.ajaxPath+"/AlertInfo/add1.do",  
			type: "post",
			data : params,  
			dataType : "json",  
			success : function(response, textStatus) {      
				/* alert("id123-->" + response.id + "; message-->" + response.message); */  
				if (response.message == true) {     
					alert("保存成功!");
					 window.location.href = Global.common.ajaxPath+"/jsp/alertInfo_list.jsp";
					//window.history.back(-1); 
				}else{  
					alert("保存失败!");  
				}  
			},  
			error : function(textStatus, e) {      
				alert("保存系统错误，请联系管理员！");    
			}  
		});
	}
}

/**
 * @note 靶向灾害类型点击事件
 * @author 李峰
 * @create_time 2017-07-25
 */
function bxfbDisasterTypeClickFunc(){
	var deptObj=$("#bxfb_zhlx_input");
	var deptOffset=$("#bxfb_zhlx_input").offset();
	$("#disaTreeContent").css({width:deptOffset.left+"px", top:deptOffset.top+deptObj.outerHeight()+"px"}).slideDown("fast");
	$("#treeDemo").css({width:deptObj.outerWidth()+"px"});
	var zTree=$.fn.zTree.getZTreeObj("treeDemo");
	var node = zTree.getNodeByParam("id",$(".menu_parent_id").val(),null);
	zTree.selectNode(node);
}

//生成tree
var setting = {    
		check:{
			enable:true,
			chkStyle: "radio",
			radioType: "level"
		},
		/*data: {
			simpleData: {
				enable: true
			}
		}*/
		data:    {
			simpleData:{
				enable:true
			}
		},
		callback:{
			onCheck:onCheck
		}
		
};
var globleids =new Array();
//ids.length=0;
//ary.length = 0;
function onCheck(e,treeId,treeNode){
	var treeObj=$.fn.zTree.getZTreeObj("treeDemo"),
	nodes=treeObj.getCheckedNodes(true);
	//globleids =new Array();
	globleids.splice(0,globleids.length);
	//console.log(nodes);
	//ids=[];
	v="";
	for(var i=0;i<nodes.length;i++){
		v+=nodes[i].name + "/";
		globleids[i] = nodes[i].id;
		//alert(nodes[i].id); //获取选中节点的值
	}
	globleids[0] = nodes[nodes.length-1].id;
	globleids[1] = nodes[nodes.length-1].name;
	$(".menu_parent_id").val(globleids[0]);
	//v = v.substring(0,v.length-1);
	$("#bxfb_zhlx_input").val(globleids[1]);
}

$.get(Global.common.ajaxPath+"/Disatype/getDisasters.do",{},function(data){  
	var zNodes=data; 
	$.fn.zTree.init($("#treeDemo"), setting, zNodes).expandAll(true);  
}); 

//Body鼠标按下事件回调函数
function onBodyDownByDisa(event){
	if(event.target.id.indexOf('treeDemo')==-1 && event.target.id != "bxfb_zhlx_input"){
		//hideDisaMenu();
	}
}

var alamlevel = null;
var disaId1 = null;



/**
  *@author: lifeng
  *@since 2017-7-26 
  *@describ 监听下拉树的value
  */

var inputValueSendUserGroupListen= function(){
	var v=$("#bxfb_zhlx_input").val();
	if(v == null || v == ""){
		$("#menu_parent_id").val("");
	}
}